package com.ss.android.common.constants;


import android.text.TextUtils;

import com.ss.android.auto.constant.BuildConfig;

public class NetConstants {

    /*********************************************
     * Network/Message Results
     *********************************************/
    public static final int MSG_OK                          = 10;
    public static final int MSG_ERROR                       = 11;

    public static final int OP_ERROR_NO_CONNECTION          = 12;
    public static final int OP_ERROR_CONNECT_TIMEOUT        = 13;
    public static final int OP_ERROR_NETWORK_TIMEOUT        = 14;
    public static final int OP_ERROR_NETWORK_ERROR          = 15;
    public static final int OP_ERROR_SERVER_ERROR           = 16;
    public static final int OP_ERROR_API_ERROR              = 17;
    public static final int OP_ERROR_UNKNOWN                = 18;
    public static final int OP_ERROR_SERVICE_UNAVAILABLE    = 19;
    public static final int OP_ERROR_RESPONSE_LENGTH_EXCEED = 20;
    public static final int OP_ERROR_SSL                    = 21;
    public static final int OP_ERROR_INTERUPTED             = 22;
    public static final int OP_ERROR_HIJACK_DATA            = 23;

    public static final int MSG_POST_FEEDBACK_OK            = 10001;
    public static final int MSG_POST_FEEDBACK_ERROR         = 10002;
    public static final int MSG_APP_ALERT_OK                = 10003;
    public static final int MSG_APP_ALERT_ERROR             = 10004;
    public static final int MSG_SEND_SETTING_OK             = 10005;
    public static final int MSG_SEND_SETTING_ERROR          = 10006;
    public static final int MSG_COMPRESS_OK                 = 10007;
    public static final int MSG_GET_SETTING_OK              = 10008;
    public static final int MSG_GET_SETTING_ERROR           = 10009;
    public static final int MSG_BLOCK_WEBVIEW_NETWORK       = 10011;
    public static final int MSG_QUERY_NETWORK               = 10012;


    public static final String BUNDLE_GROUP_ID = "group_id";//相同文章组（同文章不同来源）
    public static final String BUNDLE_ITEM_ID = "item_id";//文章id
    public static final String BUNDLE_AGGR_TYPE = "aggr_type";
    public static final String BUNDLE_AD_ID = "ad_id";
    public final static String BUNDLE_REPORT_TYPE = "report_type";
    public static final String BUNDLE_REPORT_VIDEO_ID = "report_video_id";
    public static final String HTTP_H_REFERER       = "Referer";
    public static final int REPORT_TYPE_ARTICLE = 0;
    public static final int REPORT_TYPE_USER = 1;
    public static final int REPORT_TYPE_ESSAY = 2;
    public static final int REPORT_TYPE_POST = 3;
    public static final int REPORT_TYPE_VIDEO = 4;
    public static final int REPORT_TYPE_CHEYOUSHUO = 5;
    public static final String HTTP_H_USER_AGENT    = "User-Agent";
    /*********************************************
     * Host
     *********************************************/
    public static final String API_HOST_IB = "ib.snssdk.com";
    public static final String API_HOST_DCAR = "api.dcarapi.com";
    public static final String API_BOE_SUFFIX = ".boe-gateway.byted.org";

    /*********************************************
     * Url
     *********************************************/
    public static final String API_URL_PREFIX_I         = "https://" + UrlConsts.API_HOST_I;
    public static final String API_URL_PREFIX_API       = "https://" + UrlConsts.API_HOST_API;
    public static final String API_URL_PREFIX_SRV       = "https://" + UrlConsts.API_HOST_SRV;
    public static final String API_URL_PREFIX_SI        = (BuildConfig.DEBUG ? "http://" : "https://") + UrlConsts.API_HOST_SI;
    public static final String API_URL_PREFIX_AUTO      = "https://" + API_HOST_IB;
    public static final String API_URL_PREFIX_DCAR      = "https://" + API_HOST_DCAR;

    public static String getApiUrlPrefixDcar() {
        return API_URL_PREFIX_DCAR;
    }


    public static String i(final String path) {
        if (!TextUtils.isEmpty(path)
                && path.startsWith("/motor/")) {
            return API_URL_PREFIX_DCAR + path;
        }
        return API_URL_PREFIX_I + path;
    }

    public static String si(final String path) {
        return API_URL_PREFIX_SI + path;
    }

    public static String api(final String path) {
        return API_URL_PREFIX_API + path;
    }

    public static String srv(final String path) {
        return API_URL_PREFIX_SRV + path;
    }

    public static String auto(final String path) {
        if (!TextUtils.isEmpty(path)
                && path.startsWith("/motor/")) {
            return API_URL_PREFIX_DCAR + path;
        }
        return API_URL_PREFIX_AUTO + path;
    }

    public static final String LOCATION_UPLOAD_URL      = i("/location/suloin/");
    public static final String USER_CITY_UPLOAD_URL     = i("/location/suusci/");
    public static final String USER_CITY_CANCEL_URL     = i("/location/cancel/");

    // AiLab活体认证host地址
    public static final String AI_LAB_LIVE_SDK_HOST = "https://rc.snssdk.com";

    // 个人信息保护 url
    public static final String DEALER_CLAUSE_URL = NetConstants.auto("/magic/page/ejs/5e16ff9f41becd027a7c78a1");

    //二手车个人信息保护 url
    public static final String SH_DEALER_CLAUSE_URL = "https://lf3-cdn-tos.draftstatic.com/obj/ies-hotsoon-draft/automobile/3f3fe9f5-85b4-430c-9cef-a2e7bdbc180e.html";


    public static final String INFO_BASE_PATH = "/motor/information/api/base/";
    public static final String KEY_PUSH_PRELOAD_PATH = "push_preload_path";
    public static final String KEY_PUSH_PRELOAD_RESPONSE_TAG = "push_preload_response_tag";
}
